<script setup>
import { onMounted } from "vue";

const emit = defineEmits(["childClick"]);

onMounted(() => {
  emit("childClick", "声明式触发事件");
});
</script>

<template>
  <h2>子组件</h2>
  <button @click="$emit('childClick', 'xdclass.net')">子组件的按钮</button>
</template>
